package com.bigdata.bookinfo.job;

import com.bigdata.bookinfo.Utils.MyUtil;
import com.bigdata.bookinfo.mapper.DateBookNumMapper;
import com.bigdata.bookinfo.reduce.DateBookNumReduce;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.conf.Configured;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.util.Tool;
import org.apache.hadoop.util.ToolRunner;

public class JobMain5 extends Configured implements Tool {

//    每年出版的书藉数量
    public static void main(String[] args) throws Exception {
        Configuration configuration = new Configuration();
        ToolRunner.run(configuration, new JobMain5(), args);
    }

    @Override
    public int run(String[] strings) throws Exception {
        Job job = Job.getInstance(super.getConf(), "mapreduce_book");
        String inputPath = "hdfs://127.0.0.1:9000/user/data/out/part-r-00000";
        String outputPath = "hdfs://127.0.0.1:9000/user/out/out5";
        return MyUtil.run(job, inputPath,outputPath, DateBookNumMapper.class, IntWritable.class, DateBookNumReduce.class);
    }
}
